home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Reversed wipes ƒ / Caste wipe right.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-11  |  2.4 KB  |  74 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Caste wipe right.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 1
  32. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  33. #define theWindowWidth (boundsRect.right-boundsRect.left)
  34.  
  35. pascal short CasteWipeRight(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  36.  
  37. /* This takes a strip (starting with the rightmost strip, moving left) and
  38.    copies it into all the strips starting at the left and moving right until
  39.    it's in the right place. */
  40.    
  41. pascal short CasteWipeRight(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  42. {
  43.     int                srcx, barpos;
  44.     Rect            src, dest;
  45.     Boolean            everyOther;
  46.     int                gap;
  47.     
  48.     gap=theWindowWidth/30;
  49.     everyOther=FALSE;
  50.     src.top = boundsRect.top;
  51.     src.bottom = boundsRect.bottom;
  52.     
  53.     for(srcx = boundsRect.right-gap; srcx >= boundsRect.left; srcx -= gap)
  54.     {
  55.         for(barpos = boundsRect.right; barpos >= boundsRect.left+gap; barpos -= gap);
  56.         for(; barpos <= srcx; barpos += gap)
  57.         {
  58.             StartTiming();
  59.             src.left = srcx;
  60.             src.right = srcx + gap;
  61.             dest = src;
  62.             dest.left = barpos;
  63.             dest.right = barpos + gap;
  64.             CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  65.                     &src, &dest, 0, 0L);
  66.             if (everyOther)                        /* really, we need time */
  67.                 TimeCorrection(CorrectTime);       /* correction 0.5, but  */
  68.             everyOther=!everyOther;                /* this will do (gag)   */
  69.         }
  70.     }
  71.     
  72.     return 0;
  73. }
  74.